using System;
using System.ComponentModel;
using System.Transactions;

using SIS.ENT;
using SIS.DAL;


namespace SIS.BLL {

/// <summary>
/// The EnquiryReasonTypeTableManager class is responsible for managing BO.EnquiryReasonTypeTable objects in the system.
/// </summary>
[DataObjectAttribute()]
public class EnquiryReasonTypeTableManager
  {

#region "Public Methods"

/// <summary>
/// Gets a list with all EnquiryReasonTypeTable objects in the database.
/// </summary>
/// <returns>A list with all EnquiryReasonTypeTable from the database when the database contains any, or null otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, true)]
public static EnquiryReasonTypeTableList GetList(){
return EnquiryReasonTypeTableDB.GetList();
}

/// <summary>
/// Gets a single EnquiryReasonTypeTable from the database without its data.
/// </summary>
/// <param name="enquiryReasonType">The EnquiryReasonType of the EnquiryReasonTypeTable in the database.</param>
/// <returns>A EnquiryReasonTypeTable object when the EnquiryReasonType exists in the database, or <see langword="null"/> otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static EnquiryReasonTypeTable GetItem(short enquiryReasonType){
return GetItem(enquiryReasonType, false);
}

/// <summary>
/// Gets a single EnquiryReasonTypeTable from the database.
/// </summary>
/// <param name="enquiryReasonType">The EnquiryReasonType of the EnquiryReasonTypeTable in the database.</param>
/// <param name="getEnquiryReasonTypeTableRecords">Determines whether to load all associated EnquiryReasonTypeTable records as well.</param>
/// <returns>
/// A EnquiryReasonTypeTable object when the EnquiryReasonType exists in the database, or <see langword="null"/> otherwise.
/// </returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static EnquiryReasonTypeTable GetItem(short enquiryReasonType, bool getEnquiryReasonTypeTableRecords){
EnquiryReasonTypeTable myEnquiryReasonTypeTable = EnquiryReasonTypeTableDB.GetItem(enquiryReasonType);
return myEnquiryReasonTypeTable;
}

/// <summary>
/// Saves a EnquiryReasonTypeTable in the database.
/// </summary>
/// <param name="myEnquiryReasonTypeTable">The EnquiryReasonTypeTable instance to save.</param>
/// <returns>The new EnquiryReasonType if the EnquiryReasonTypeTable is new in the database or the existing EnquiryReasonType when an item was updated.</returns>
[DataObjectMethod(DataObjectMethodType.Update, true)]
public static short Save(EnquiryReasonTypeTable myEnquiryReasonTypeTable){
using (TransactionScope myTransactionScope = new TransactionScope()){
short enquiryReasonTypeTableEnquiryReasonType = EnquiryReasonTypeTableDB.Save(myEnquiryReasonTypeTable);

//  Assign the EnquiryReasonTypeTable its new (or existing EnquiryReasonType).
myEnquiryReasonTypeTable.EnquiryReasonType = enquiryReasonTypeTableEnquiryReasonType;

myTransactionScope.Complete();

return enquiryReasonTypeTableEnquiryReasonType;
}
}

/// <summary>
/// Deletes a EnquiryReasonTypeTable from the database.
/// </summary>
/// <param name="myEnquiryReasonTypeTable">The EnquiryReasonTypeTable instance to delete.</param>
/// <returns>Returns true when the object was deleted successfully, or false otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Delete, true)]
public static bool Delete(EnquiryReasonTypeTable myEnquiryReasonTypeTable){
return EnquiryReasonTypeTableDB.Delete(myEnquiryReasonTypeTable.EnquiryReasonType);
}

#endregion

}

}
